{extend name="default/layout" /}

{block name="content"}
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">

    <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">

        <!-- 侧边栏导航 -->
        {assign name="current" value="vip" /}
        {include file="default/components/user-sidebar" /}

        <!-- 主要内容区域 -->
        <div class="lg:col-span-3 space-y-6">

            <!-- VIP状态卡片 -->
            <div class="bg-white rounded-lg p-4">
                <div class="flex items-center justify-between">
                    <div class="flex items-center">
                        <div class="w-12 h-12 bg-yellow-100 rounded-lg flex items-center justify-center mr-3">
                            <i class="fas fa-crown text-yellow-500 text-lg"></i>
                        </div>
                        <div>
                            <h1 class="text-lg font-semibold text-gray-800">VIP会员</h1>
                            {if $user.is_vip == 1}
                            <p class="text-sm text-gray-600">当前套餐：{$vip_info.name|default='VIP会员'} · 剩余 {$expire_days} 天</p>
                            {else}
                            <p class="text-sm text-gray-600">升级VIP，享受专属特权</p>
                            {/if}
                        </div>
                    </div>
                    <div class="text-right">
                        {if $user.is_vip == 1}
                        <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800">
                            <i class="fas fa-star mr-1"></i>
                            VIP会员
                        </span>
                        {else}
                        <button onclick="scrollToVipPackages()" class="bg-yellow-500 text-white px-4 py-2 rounded-lg hover:bg-yellow-600 transition-colors text-sm">
                            <i class="fas fa-crown mr-1"></i>
                            立即开通
                        </button>
                        {/if}
                    </div>
                </div>
            </div>

            <!-- VIP特权介绍 -->
            <div class="bg-white rounded-lg p-6 mb-6">
                <h2 class="text-xl font-semibold text-gray-800 mb-6 text-center">VIP专属特权</h2>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="text-center p-4">
                        <div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <i class="fas fa-unlock text-blue-500 text-2xl"></i>
                        </div>
                        <h3 class="font-semibold text-gray-800 mb-2">免费内容</h3>
                        <p class="text-gray-500 text-sm">VIP用户可免费查看所有付费内容</p>
                    </div>
                    <div class="text-center p-4">
                        <div class="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <i class="fas fa-headset text-purple-500 text-2xl"></i>
                        </div>
                        <h3 class="font-semibold text-gray-800 mb-2">专属客服</h3>
                        <p class="text-gray-500 text-sm">享受VIP专属客服支持</p>
                    </div>
                    <div class="text-center p-4">
                        <div class="w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <i class="fas fa-crown text-yellow-500 text-2xl"></i>
                        </div>
                        <h3 class="font-semibold text-gray-800 mb-2">身份标识</h3>
                        <p class="text-gray-500 text-sm">专属VIP身份标识和头像框</p>
                    </div>
                </div>
            </div>

            <!-- VIP套餐 -->
            <div class="bg-white rounded-lg p-6" id="vip-packages">
                <h2 class="text-xl font-semibold text-gray-800 mb-6 text-center">VIP套餐</h2>
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6" id="packages-grid">
            {volist name="vip_packages" id="package" key="index"}
            <div class="bg-white rounded-sm p-6 border {if $index == 3}border-2 border-yellow-400{else}border-gray-200{/if} relative hover:border-blue-400 hover:shadow-lg transition-all duration-300 flex flex-col h-full">
                {if $index == 3}
                <div class="absolute -top-3 left-1/2 transform -translate-x-1/2">
                    <span class="bg-yellow-400 text-yellow-900 px-3 py-1 rounded-full text-xs font-medium">
                        推荐
                    </span>
                </div>
                {/if}
                <div class="text-center flex-1 flex flex-col">
                    <h3 class="text-lg font-semibold text-gray-800 mb-2">{$package.name}</h3>
                    <div class="text-3xl font-bold text-blue-500 mb-4">
                        ¥{$package.price}<span class="text-sm font-normal">/{$package.duration}天</span>
                    </div>
                    <div class="text-sm text-gray-500 mb-4">{$package.description}</div>
                    <ul class="text-sm text-gray-500 space-y-2 mb-6 flex-1">
                        <li><i class="fas fa-check text-green-500 mr-2"></i>所有VIP特权</li>
                        <li><i class="fas fa-check text-green-500 mr-2"></i>{$package.duration}天有效期</li>
                        <li><i class="fas fa-check text-green-500 mr-2"></i>赠送{$package.points_reward}积分</li>
                        {if $package.exclusive_content == 1}
                        <li><i class="fas fa-check text-green-500 mr-2"></i>专属内容访问权限</li>
                        {/if}
                    </ul>
                    <button onclick="buyVip({$package.id}, '{$package.name}', {$package.price})"
                            class="w-full {if $index == 3}bg-yellow-500 hover:bg-yellow-600{else}bg-blue-500 hover:bg-blue-600{/if} text-white py-3 rounded-sm transition-colors mt-auto">
                        {if $user.is_vip == 1}立即续费{else}立即购买{/if}
                    </button>
                </div>
            </div>
            {/volist}
                </div>
            </div>

            <!-- 常见问题 -->
            <div class="bg-white rounded-lg p-6">
                <h2 class="text-xl font-semibold text-gray-800 mb-6 text-center">常见问题</h2>
        <div class="space-y-4">
            <div>
                <h3 class="font-medium text-gray-800 mb-2">Q: VIP会员有什么特权？</h3>
                <p class="text-gray-500 text-sm">A: VIP会员可以免费查看所有付费内容，享受无限下载、专属客服等特权。</p>
            </div>
            <div>
                <h3 class="font-medium text-gray-800 mb-2">Q: 如何取消VIP订阅？</h3>
                <p class="text-gray-500 text-sm">A: 您可以在用户中心的VIP管理页面随时取消订阅，取消后仍可使用到期。</p>
            </div>
            <div>
                <h3 class="font-medium text-gray-800 mb-2">Q: VIP到期后会怎样？</h3>
                <p class="text-gray-500 text-sm">A: VIP到期后将恢复为普通用户，之前下载的内容仍可正常使用。</p>
            </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="js"}
<!-- 引入外部JS文件 -->
<script src="/static/default/js/user/vip.js?v={$static_version}"></script>

{/block}
